﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SacNetUG.Models
{
    public class StateViewModel
    {
        public int Page { get; private set; }
        public int PreviousPage { get; private set; }
        public int NextPage { get; private set; }
        public int TotalPageCount { get; private set; }
        public List<State> States { get; private set; }
        private ISacNetUGRepository repository;

        public StateViewModel(int page, ISacNetUGRepository repo)
        {
            Page = page;
            PreviousPage = page > 1 ? page - 1 : 1;
            repository = repo;
            TotalPageCount = repository.GetStatePageCount();
            NextPage = (page+1) > TotalPageCount ? TotalPageCount : page + 1;
            States = repository.GetStates(page).ToList();
        }
    }
}
